#pragma once

#include <d3d10.h>
#include <d3dx10.h>
#include <map>
#include <list>
#include <string.h>

#include "Model.h"
#include "EnginePointer.h"
#include "EngineObject.h"
#include "SdkMesh.h"

using namespace std;

class ModelLoader : public EngineObject
{
public:
	~ModelLoader();
	HRESULT LoadModel(char* path, EnginePointer<Model>& model);
	HRESULT LoadModel(int resource, EnginePointer<Model>& model);

	AUTO_SIZE;
private:
	HRESULT LoadModel(BYTE* data, EnginePointer<Model>& model);
	HRESULT FillSdkMesh(SDKMESH* mesh, BYTE* data);
	void ConvertToModel(SDKMESH* mesh, EnginePointer<Model>& model);

	map<char*, EnginePointer<Model>> loadedModels;
};
